const tableData = [
  {
    id: 1,
    projectName: '百度一下',
    projectType: '1',
    projectTypeName: '百度百科',
    address: 'https://www.baidu.com/',
    uploadTime: '2016-05-03',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    state: '1',
    userArr: ['1'],
    mark: '备注9999',
    firstDep: '01',
    secondDep: '0102',
    files: [
      {
        fileId: '1',
        fileName: '附件111',
        fileUrl:
          'http://th1-oss.bimfound.cn/FileManage/202404/22/湖北开放职业学院梧桐湖新校区项目创建所需资料02.20(1).docx',
      },
      {
        fileId: '2',
        fileName: '测试附件222',
        fileUrl:
          'http://th1-oss.bimfound.cn/FileManage/202404/22/湖北开放职业学院梧桐湖新校区项目创建所需资料02.20(1).docx',
      },
    ],
  },
  {
    id: 2,
    projectName: '淘宝',
    projectType: '2',
    projectTypeName: '网购商城',
    uploadTime: '2016-05-02',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://www.taobao.com/',
    userArr: ['1', '2'],
    state: '1',
    mark: '',
    firstDep: '',
    secondDep: '',
  },
  {
    id: 3,
    projectName: '京东',
    projectType: '2',
    projectTypeName: '网购商城',
    uploadTime: '2016-05-04',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://www.jd.com/',
    userArr: ['4', '5', '6'],
    state: '1',
  },
  {
    id: 4,
    projectName: '暴雪',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 5,
    projectName: '暴雪1122',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '0',
  },
  {
    id: 6,
    projectName: '暴雪1',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 7,
    projectName: '暴雪2',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '0',
  },
  {
    id: 8,
    projectName: '暴雪3',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '0',
  },
  {
    id: 9,
    projectName: '暴雪4',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 10,
    projectName: '暴雪5',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 11,
    projectName: '暴雪6',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 12,
    projectName: '暴雪7',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 13,
    projectName: '暴雪8',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 14,
    projectName: '暴雪9',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 15,
    projectName: '暴雪10',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 16,
    projectName: '暴雪11',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 17,
    projectName: '暴雪12',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 18,
    projectName: '暴雪13',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 19,
    projectName: '暴雪14',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 20,
    projectName: '暴雪15',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
  {
    id: 21,
    projectName: '暴雪16',
    projectType: '3',
    projectTypeName: '游戏',
    uploadTime: '2016-05-01',
    uploadTimeArr: ['2016-05-03', '2024-05-03'],
    address: 'https://us.shop.battle.net/zh-tw',
    userArr: ['1', '2', '3', '4', '5', '6'],
    state: '1',
  },
];

//查询列表数据接口
export const getTableDataAPI = (param: any = {}) => {
  let arrData = [];
  const { currentPage, pageSize, ...obj } = param;
  const keys = Object.keys(obj);
  if (keys.length) {
    keys.forEach((key) => {
      if (typeof obj[key] !== 'object') {
        let arr = [];
        arr = tableData.filter((item) => item[key] === obj[key]);
        arrData = [...arrData, ...arr];
      }
    });
  } else {
    arrData = tableData;
  }
  const resultData = arrData.slice((currentPage - 1) * pageSize, currentPage * pageSize);

  return Promise.resolve({
    code: 200,
    message: '操作成功',
    result: resultData,
    total: arrData.length,
  });
};
